﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

namespace 视频流媒体管理
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            Code.摄像机管理.ONE.保活超时分钟数 = int.Parse(System.Configuration.ConfigurationManager.AppSettings["自动关闭拉流超时分钟"]);
            string[] msg = System.Configuration.ConfigurationManager.AppSettings["流媒体服务器"].Split(',');
            Code.摄像机管理.ONE.host = msg[0].Trim();
            string username = msg[1].Trim();
            string pwd = msg[2].Trim();
            string info = Code.摄像机管理.ONE.登录(username, pwd);

            string t = this.Server.MapPath("App_Data");
            Code.log.ONE.logfile = System.IO.Path.Combine(t, DateTime.Now.ToString("yyyy-MM-dd") + "log.txt");
            Code.log.ONE.写日志(info);

            string xls = System.IO.Path.Combine(t, "摄像机列表.xlsx");
            Code.摄像机管理.ONE.加载摄像机列表xls(xls);
        }


        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {
            Code.摄像机管理.ONE.退出登录();
        }
    }
}